﻿<controls:ChildWindow x:Class="AdventureWorksLT.Views.Customers.ChildWindows.SalesOrderHeaderCW"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
mc:Ignorable="d"
Title="SalesOrderHeaderEditWindow"
xmlns:viewModels="clr-namespace:AdventureWorksLT.Views.Customers.ViewModels"
xmlns:SaleControls="clr-namespace:AdventureWorksLT.Views.Customers.Controls" 
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:appControls="clr-namespace:AdventureWorksLT.Controls">
<!--22 Fields --> 
    <controls:ChildWindow.Resources>
        <viewModels:SalesOrderHeadersViewModel x:Key="SalesOrderHeadersViewModel"></viewModels:SalesOrderHeadersViewModel>
    </controls:ChildWindow.Resources>
    <appControls:BusyIndicator x:Name="BusyIndicator" BusyContent="Loading Patients data...." DataContext="{Binding Source={StaticResource SalesOrderHeadersViewModel}}" Foreground="SlateGray" IsBusy="{Binding IsBusy}">
        <ScrollViewer x:Name="scrollViewerSalesOrderHeader" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >
<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SalesOrderHeadersViewModel}}" Background="WhiteSmoke" >
        <Border BorderBrush="#FF505050"  BorderThickness="2"  CornerRadius="10">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#EDD1DE86" Offset="0.8" />
                    <GradientStop Color="AliceBlue" Offset="1.09" />
                </LinearGradientBrush>
          </Border.Background>

<Grid HorizontalAlignment="Left" x:Name="SalesOrderHeaderGrid" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="32" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
    <ColumnDefinition Width="30" />
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="Auto" />
	<ColumnDefinition Width="50" />
	<ColumnDefinition Width="Auto" />
	<ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>


<StackPanel Grid.Column="1" Grid.Row="1" Orientation="vertical"  >
<TextBlock Height="20" Margin="0,5" ToolTipService.ToolTip="Sales Order Id" ToolTipService.Placement="Right" Text="Sales Order Id:"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Revision Number" ToolTipService.Placement="Right" Text="Revision Number:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Order Date" ToolTipService.Placement="Right" Text="Order Date:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Due Date" ToolTipService.Placement="Right" Text="Due Date:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Ship Date" ToolTipService.Placement="Right" Text="Ship Date:"  Margin="0,5" Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Status" ToolTipService.Placement="Right" Text="Status:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Online Order Flag" ToolTipService.Placement="Right" Text="Online Order Flag:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Sales Order Number" ToolTipService.Placement="Right" Text="Sales Order Number:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Purchase Order Number" ToolTipService.Placement="Right" Text="Purchase Order Number:"  Margin="0,5" Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Account Number" ToolTipService.Placement="Right" Text="Account Number:"  Margin="0,5" Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Customer Id" ToolTipService.Placement="Right" Text="Customer Id:"  Margin="0,5"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />

</StackPanel>
<StackPanel Grid.Column="2" Grid.Row="1" Orientation="vertical"  >
<TextBlock  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="SalesOrderIDTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.SalesOrderID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
<TextBox ToolTipService.ToolTip="Revision Number" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="RevisionNumberTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.RevisionNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC" />
<sdk:DatePicker ToolTipService.ToolTip="Order Date" ToolTipService.Placement="Right"  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="OrderDateDatePicker" SelectedDate="{Binding Path=CurrentSalesOrderHeaders.OrderDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left" />
<sdk:DatePicker ToolTipService.ToolTip="Due Date" ToolTipService.Placement="Right"  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="DueDateDatePicker" SelectedDate="{Binding Path=CurrentSalesOrderHeaders.DueDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left" />
<sdk:DatePicker ToolTipService.ToolTip="Ship Date" ToolTipService.Placement="Right"  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="ShipDateDatePicker" SelectedDate="{Binding Path=CurrentSalesOrderHeaders.ShipDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left" />
<TextBox ToolTipService.ToolTip="Status" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="StatusTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.Status, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC" />
<CheckBox ToolTipService.ToolTip="Online Order Flag" ToolTipService.Placement="Right" Content=""  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="OnlineOrderFlagCheckBox" IsChecked="{Binding Path=CurrentSalesOrderHeaders.OnlineOrderFlag, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left" />
<TextBox ToolTipService.ToolTip="Sales Order Number" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="SalesOrderNumberTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.SalesOrderNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC"  MaxLength="25"/>
<TextBox ToolTipService.ToolTip="Purchase Order Number" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="PurchaseOrderNumberTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.PurchaseOrderNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  MaxLength="25"/>
<TextBox ToolTipService.ToolTip="Account Number" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="AccountNumberTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.AccountNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  MaxLength="15"/>
<TextBlock  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="CustomerIDTextBox" Text="{Binding Path=CustomerID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120"  />

</StackPanel>
                        <StackPanel Margin="0,10" Grid.Column="0" Grid.Row="2" Orientation="Horizontal"  Grid.ColumnSpan="3">
                            <Button Margin="20,0,0,0" Style="{StaticResource GreenButton}" x:Name="CancelButton" Content="Cancel"  Background="Blue" Width="75" Height="23" HorizontalAlignment="Right"  />
                            <Button Margin="20,0,0,0" Style="{StaticResource OrangeButton}" x:Name="SaveButton" Content="Save" Background="Green" Width="75" Height="23" HorizontalAlignment="Right" Command="{Binding SaveCommand}" />
                        </StackPanel>
           <StackPanel Orientation="Horizontal" Margin="0,20,0,0" Grid.Column="5" Grid.Row="1" >
                <StackPanel Orientation="Vertical" Margin="0,10,0,0" Grid.Column="6" Grid.Row="1" >
                    <TextBlock Height="20" ToolTipService.ToolTip="Ship To Address Id" ToolTipService.Placement="Right" Text="Ship To Address Id:"  Margin="0,10,0,0"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Bill To Address Id" ToolTipService.Placement="Right" Text="Bill To Address Id:"  Margin="0,5"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Ship Method" ToolTipService.Placement="Right" Text="Ship Method:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Credit Card Approval Code" ToolTipService.Placement="Right" Text="Credit Card Approval Code:"  Margin="0,5" Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Sub Total" ToolTipService.Placement="Right" Text="Sub Total:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Tax Amt" ToolTipService.Placement="Right" Text="Tax Amt:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Freight" ToolTipService.Placement="Right" Text="Freight:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Total Due" ToolTipService.Placement="Right" Text="Total Due:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Comment" ToolTipService.Placement="Right" Text="Comment:"  Margin="0,5" Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Rowguid" ToolTipService.Placement="Right" Text="Rowguid:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />
<TextBlock Height="20" ToolTipService.ToolTip="Modified Date" ToolTipService.Placement="Right" Text="Modified Date:"  Margin="0,5" Foreground="#FF7635FC" FontWeight="Bold"  Width="180" TextWrapping="Wrap" FontFamily="Portable User Interface" FontSize="11" TextTrimming="None" />

                </StackPanel>
                <StackPanel Orientation="Vertical" Margin="0,10,0,0" >
                                <TextBlock  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="ShipToAddressIDTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.ShipToAddressID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" Visibility="Collapsed" />
<ComboBox ToolTipService.ToolTip="Ship To Address Id" ToolTipService.Placement="Right" Height="26" Margin="2" x:Name="ShipToAddressIDComboBox" ItemsSource="{Binding ShipToAddressCollection, Mode=TwoWay}" SelectedItem="{Binding SelectedShipToAddress, Mode=TwoWay}" DisplayMemberPath = "AddressLine1"  VerticalAlignment="Top" Width="150" >
<ComboBox.BorderBrush>
<SolidColorBrush Color="GreenYellow"/>
</ComboBox.BorderBrush>
</ComboBox>
<TextBlock  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="BillToAddressIDTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.BillToAddressID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" Visibility="Collapsed" />
<ComboBox ToolTipService.ToolTip="Bill To Address Id" ToolTipService.Placement="Right" Height="26" Margin="2" x:Name="BillToAddressIDComboBox" ItemsSource="{Binding BillToAddressCollection, Mode=TwoWay}" SelectedItem="{Binding SelectedBillToAddress, Mode=TwoWay}"  DisplayMemberPath = "AddressLine1"  VerticalAlignment="Top" Width="150" >
<ComboBox.BorderBrush>
<SolidColorBrush Color="GreenYellow"/>
</ComboBox.BorderBrush>
</ComboBox>
<TextBox ToolTipService.ToolTip="Ship Method" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="ShipMethodTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.ShipMethod, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC"  MaxLength="50"/>
<TextBox ToolTipService.ToolTip="Credit Card Approval Code" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="CreditCardApprovalCodeTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.CreditCardApprovalCode, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  MaxLength="15"/>
<TextBox ToolTipService.ToolTip="Sub Total" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="SubTotalTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.SubTotal, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC" />
<TextBox ToolTipService.ToolTip="Tax Amt" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="TaxAmtTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.TaxAmt, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC" />
<TextBox ToolTipService.ToolTip="Freight" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="FreightTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.Freight, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC" />
<TextBox ToolTipService.ToolTip="Total Due" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="TotalDueTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.TotalDue, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC" />
<TextBox ToolTipService.ToolTip="Comment" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="CommentTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.Comment, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  MaxLength="1000"/>
<TextBox ToolTipService.ToolTip="Rowguid" ToolTipService.Placement="Right" Height="26" HorizontalAlignment="Left" Margin="2" x:Name="rowguidTextBox" Text="{Binding Path=CurrentSalesOrderHeaders.rowguid, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left"  Background="#FFFFFFDC" />
<sdk:DatePicker ToolTipService.ToolTip="Modified Date" ToolTipService.Placement="Right"  Height="26" HorizontalAlignment="Left" Margin="2" x:Name="ModifiedDateDatePicker" SelectedDate="{Binding Path=CurrentSalesOrderHeaders.ModifiedDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" HorizontalContentAlignment="Left" />

                </StackPanel>
            </StackPanel>
                        <StackPanel Margin="0,10" Grid.Column="0" Grid.Row="3"   Grid.ColumnSpan="6" >
                            <SaleControls:SalesOrderDetailGrid></SaleControls:SalesOrderDetailGrid>
                        </StackPanel>
                    </Grid>
    
        
        </Border>

        </Grid>
        </ScrollViewer>
    </appControls:BusyIndicator>
</controls:ChildWindow>
